package com.easyhouse.processor;

import com.alibaba.schedulerx.shade.com.google.common.collect.Lists;

import com.easyhouse.task.TaskParamDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Component
public class MyJobAlertProcessor extends AbstractMapJobProcessor<TaskParamDO> {

    @Autowired
    private EasyhouseTaskHandler easyhouseTaskHandler;

    @Override
    protected List<TaskParamDO> totalTask(Map<String, Object> context) {
        ArrayList<TaskParamDO> objects = Lists.newArrayList();
        TaskParamDO build = TaskParamDO.builder().name("mytask1!!!!!").build();
        //TaskParamDO build2 = TaskParamDO.builder().name("mytask2!!!!!").build();
        //TaskParamDO build3 = TaskParamDO.builder().name("mytask3!!!!!").build();

        objects.add(build);
        //objects.add(build2);
        //objects.add(build3);
        return objects;
    }

    @Override
    protected String getTaskName() {
        return "Zjssoul job";
    }

    @Override
    protected int getSizePerPartition() {
        return 1;
    }

    @Override
    protected void processOneTask(long now, TaskParamDO task) {
        easyhouseTaskHandler.runTask();
    }
}
